<?php

use Illuminate\Http\Request;
use App\Models\Mysql\XnOrder;
use App\Jobs\orderCallbackNotify;
use Illuminate\Support\Facades\Route;
use App\Recharge\Logic\ApiNotifyLogic;
use App\Recharge\Bean\ApiNotifyDataBean;


Route::middleware('api')->group(function (){
    //商户登录
    Route::prefix('logon')->group(function () {
        Route::controller(\App\Http\Controllers\merchant\MerchantLogonController::class)->group(function () {
            Route::post('register', "register");     // 注册
            Route::post('no_password', "no_password");     // 忘记密码
            Route::post('login', "login");     // 登录
            Route::post('logout', "logout");   // 退出
            Route::post('refresh', "refresh"); // 刷新token
            Route::post('authentication', "authentication"); // 实名认证
            Route::post('authentication_info', "authentication_info"); // 实名认证信息页
            Route::post('uploadpic', "uploadpic"); // 图片上传
        });
    });
//商户商品
    Route::prefix('goods')->group(function () {
        Route::controller(\App\Http\Controllers\merchant\MerchantGoodsController::class)->middleware("auth:merchant")->group(function () {
            Route::post('list', "list");// 商品列表
            Route::post('invoicing_list', "invoicing_list");// 商品带票列表
            Route::post('refresh_balance', "refresh_balance");// 商户刷新余额
            Route::post('Balance_alarm', "Balance_alarm");// 商户开启余额报警
            Route::post('check_key', "check_key");// 商户查询密钥
            Route::post('resetting_key', "resetting_key");//重置密钥
        });
    });
//商户订单
    Route::prefix('order')->middleware("auth:merchant")->group(function () {
        Route::controller(\App\Http\Controllers\merchant\MerchantOrderController::class)->group(function () {
            Route::post('list', "list");     // 订单列表
            Route::post('bill_list', "bill_list");     // 账单列表
        });

    });

    //商户回调
    Route::any('/notify/{en}', function (Request $request, string $en) {
        return ApiNotifyLogic::new($request, $en)->send();
    });

//商户下单
    Route::controller(\App\Http\Controllers\order\PlaceOrderController::class)->group(function () {
        Route::any('order', "order");//下单
        //批量下单
        Route::any('batch_order', "batch_order")->middleware("auth:merchant");
    });

    //商户导出
    Route::controller(\App\Http\Controllers\excel\GoodsController::class)->group(function () {
        Route::any('orderExcel', "orderExcel");
        Route::any('orderBillExcel', "orderBillExcel");
    });
});




